<?php
$oUsergroups = UsergroupHandler::getUsergroups();
$oUsergroupAccess = JobHandler::getUsergroupAccess($_SESSION['iJobID']);
?>
<div id="layer_job_usergroupadd" class="hidden" style="visibility: visible;">
<form action="index.php" method="post" name="form_job_usergroupadd">
<input type="hidden" name="sAction" value="job-setgroupaccess">
<input type="hidden" name="sView" value="job-view">
<input type="hidden" name="oAccess[job-read]" value="1">
<table class="boxborder" cellspacing="0">
	<tr>
		<td class="boxhandle" colspan="2"><?php print msg('Add access') ?></td>
	</tr>
	<tr>
		<td class="fieldname"><?php print msg('Usergroup') ?>:</td>
		<td class="fieldvalue">
			<select name="iUsergroup">
<?php
foreach ($oUsergroups as $iID => $oThisUsergroup)
{
	if (!$oUsergroupAccess[$iID]['job']['read']) {
		echo '<option value="'.$iID.'">'.$oThisUsergroup->sName.'</option>';
	}
}
?>
			</select>
		</td>
	</tr>
	<tr>
		<td class="clear" colspan="2">
			<table cellspacing="0" style="width: 100%;">
				<tr>
					<td class="separator" colspan="2"><?php print msg('Access') ?></td>
				</tr>
				<tr>
					<td class="fieldname"><?php print msg('Project') ?>:</td>
					<td class="fieldvalue">
						<input type="checkbox" value="1" name="oAccess[job-write]"> <?php print msg('Write') ?>
					</td>
				</tr>
				<tr>
					<td class="fieldname"><?php print msg('Tasks') ?>:</td>
					<td class="fieldvalue">
						<input type="checkbox" value="1" name="oAccess[mission-read]" checked> <?php print msg('Read') ?>
						<input type="checkbox" value="1" name="oAccess[mission-write]" checked> <?php print msg('Write') ?>
					</td>
				</tr>
				<tr>
					<td class="fieldname"><?php print msg('Files') ?>:</td>
					<td class="fieldvalue">
						<input type="checkbox" value="1" name="oAccess[file-read]" checked> <?php print msg('Read') ?>
						<input type="checkbox" value="1" name="oAccess[file-write]" checked> <?php print msg('Write') ?>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr>
		<td class="boxbody" style="text-align: center;" colspan="2">
			<input type="submit" value="<?php print msg('OK') ?>">
			<input type="button" value="<?php print msg('Cancel') ?>" onClick="showBox('job-access');">
		</td>
	</tr>
</table>
</form>
</div>
